package com.kuang.mapper;

import com.kuang.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @program: spring-study
 * @description:
 * @author: 陈恩涛
 * @create: 2020-07-18 21:06
 **/
public class UserMapperImpl implements UserMapper {

    //我们的所有操作，都是用sqlSession来执行，在原来，现在都是用sqlSessionTemplate
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public List<User> getUsers() {
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.getUsers();
    }
}
